package com.qf.config;

import com.qf.interceptor.UpInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author TZL
 * @date 2020/8/7
 * WebMvcConfigurer是springMVC专有的配置类
 * 当前类等价于   mvc.xml
 */
@Configuration
public class MVCConfig implements WebMvcConfigurer {
    //注册拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器并指定拦截路径
        registry.addInterceptor(new UpInterceptor()).addPathPatterns("/up");
    }
}
